diff --git a/swad_account.c b/swad_account.c index 17e3478d9..40773e4ba 100644 --- a/swad_account.c +++ b/swad_account.c @@ -173,7 +173,7 @@ static void Acc_ShowFormRequestNewAccountWithParams (const char *NewNicknameWith NewEmail); /***** Password *****/ - Pwd_PutFormToGetNewPasswordTwice (); + Pwd_PutFormToGetNewPasswordOnce (); /***** Send button and form end *****/ Lay_EndRoundFrameTableWithButton (Lay_CREATE_BUTTON,Txt_Create_account); @@ -327,10 +327,9 @@ static bool Acc_GetParamsNewAccount (char *NewNicknameWithoutArroba, extern const char *Txt_The_nickname_entered_X_is_not_valid_; extern const char *Txt_The_email_address_X_had_been_registered_by_another_user; extern const char *Txt_The_email_address_entered_X_is_not_valid; - extern const char *Txt_You_have_not_written_twice_the_same_new_password; char Query[1024]; char NewNicknameWithArroba[Nck_MAX_BYTES_NICKNAME_WITH_ARROBA+1]; - char NewPlainPassword[2][Pwd_MAX_LENGTH_PLAIN_PASSWORD+1]; + char NewPlainPassword[Pwd_MAX_LENGTH_PLAIN_PASSWORD+1]; bool Error = false; /***** Step 1/3: Get new nickname from form *****/ @@ -391,24 +390,14 @@ static bool Acc_GetParamsNewAccount (char *NewNicknameWithoutArroba, } /***** Step 3/3: Get new password from form *****/ - Par_GetParToText ("Paswd1",NewPlainPassword[0],Pwd_MAX_LENGTH_PLAIN_PASSWORD); - Par_GetParToText ("Paswd2",NewPlainPassword[1],Pwd_MAX_LENGTH_PLAIN_PASSWORD); - if (strcmp (NewPlainPassword[0],NewPlainPassword[1])) + Par_GetParToText ("Paswd",NewPlainPassword,Pwd_MAX_LENGTH_PLAIN_PASSWORD); + Str_ChangeFormat (Str_FROM_FORM,Str_TO_TEXT, + NewPlainPassword,Pwd_MAX_LENGTH_PLAIN_PASSWORD,true); + Cry_EncryptSHA512Base64 (NewPlainPassword,NewEncryptedPassword); + if (!Pwd_SlowCheckIfPasswordIsGood (NewPlainPassword,NewEncryptedPassword,-1L)) // New password is good? { - // Passwords don't match Error = true; - Lay_ShowAlert (Lay_WARNING,Txt_You_have_not_written_twice_the_same_new_password); - } - else - { - Str_ChangeFormat (Str_FROM_FORM,Str_TO_TEXT, - NewPlainPassword[0],Pwd_MAX_LENGTH_PLAIN_PASSWORD,true); - Cry_EncryptSHA512Base64 (NewPlainPassword[0],NewEncryptedPassword); - if (!Pwd_SlowCheckIfPasswordIsGood (NewPlainPassword[0],NewEncryptedPassword,-1L)) // New password is good? - { - Error = true; - Lay_ShowAlert (Lay_WARNING,Gbl.Message); // Error message is set in Usr_SlowCheckIfPasswordIsGood - } + Lay_ShowAlert (Lay_WARNING,Gbl.Message); // Error message is set in Usr_SlowCheckIfPasswordIsGood } return !Error; diff --git a/swad_changelog.h b/swad_changelog.h index 5bd3e3efe..67f6b11e5 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -111,11 +111,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.40.7 (2015/11/20)" +#define Log_PLATFORM_VERSION "SWAD 15.40.8 (2015/11/20)" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1 /* + Version 15.40.8: Nov 20, 2015 Password is requested only one time when creating a new account. (187309 lines) Version 15.40.7: Nov 20, 2015 New help button to register students in courses without them. (187319 lines) Version 15.40.6: Nov 20, 2015 New button to register students in courses without them. New buttons to create institution, centre, degree and course. (187285 lines) diff --git a/swad_message.c b/swad_message.c index 43d67e769..825f336ba 100644 --- a/swad_message.c +++ b/swad_message.c @@ -2819,8 +2819,8 @@ static void Msg_WriteSentOrReceivedMsgSubject (Msg_TypeOfMessages_t TypeOfMessag Msg_PutHiddenParamMsgCod (MsgCod); Act_LinkFormSubmit (Expanded ? Txt_Hide_message : Txt_See_message, - Open ? "MSG_TIT_BG" : - "MSG_TIT_BG_NEW"); + Open ? "MSG_TIT" : + "MSG_TIT_NEW"); /***** Write subject *****/ if (Subject[0]) diff --git a/swad_password.c b/swad_password.c index 26e9dbd26..1fd037c78 100644 --- a/swad_password.c +++ b/swad_password.c @@ -720,6 +720,32 @@ void Pwd_ShowFormChgPwd (void) Act_FormEnd (); } +/*****************************************************************************/ +/**************** Put form to request the new password once ******************/ +/*****************************************************************************/ + +void Pwd_PutFormToGetNewPasswordOnce (void) + { + extern const char *The_ClassForm[The_NUM_THEMES]; + extern const char *Txt_Password; + extern const char *Txt_HELP_password; + + sprintf (Gbl.Message,Txt_HELP_password,Pwd_MIN_LENGTH_PLAIN_PASSWORD); + fprintf (Gbl.F.Out,"