mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 17:14:52 -07:00
Simpler forgot password functionality (#2393)
* Simpler forgot password functionality (Server/Client)
This commit is contained in:
parent
b64eab204c
commit
0cfa6863d5
36 changed files with 1190 additions and 173 deletions
|
|
@ -21,6 +21,7 @@ void FeatureSet::initalizeFeatureList(QMap<QString, bool> &featureList) {
|
|||
featureList.insert("client_warnings", false);
|
||||
featureList.insert("mod_log_lookup", false);
|
||||
featureList.insert("idle_client", false);
|
||||
featureList.insert("forgot_password", false);
|
||||
}
|
||||
|
||||
void FeatureSet::enableRequiredFeature(QMap<QString, bool> &featureList, QString featureName){
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ SET(PROTO_FILES
|
|||
response_deck_list.proto
|
||||
response_deck_upload.proto
|
||||
response_dump_zone.proto
|
||||
response_forgotpasswordrequest.proto
|
||||
response_get_games_of_user.proto
|
||||
response_get_user_info.proto
|
||||
response_join_room.proto
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ message Response {
|
|||
WARN_HISTORY = 1013;
|
||||
WARN_LIST = 1014;
|
||||
VIEW_LOG = 1015;
|
||||
FORGOT_PASSWORD_REQUEST = 1016;
|
||||
REPLAY_LIST = 1100;
|
||||
REPLAY_DOWNLOAD = 1101;
|
||||
}
|
||||
|
|
|
|||
9
common/pb/response_forgotpasswordrequest.proto
Normal file
9
common/pb/response_forgotpasswordrequest.proto
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
syntax = "proto2";
|
||||
import "response.proto";
|
||||
|
||||
message Response_ForgotPasswordRequest {
|
||||
extend Response {
|
||||
optional Response_ForgotPasswordRequest ext = 1016;
|
||||
}
|
||||
optional bool challenge_email = 1;
|
||||
}
|
||||
|
|
@ -24,6 +24,9 @@ message SessionCommand {
|
|||
ACCOUNT_EDIT = 1018;
|
||||
ACCOUNT_IMAGE = 1019;
|
||||
ACCOUNT_PASSWORD = 1020;
|
||||
FORGOT_PASSWORD_REQUEST = 1021;
|
||||
FORGOT_PASSWORD_RESET = 1022;
|
||||
FORGOT_PASSWORD_CHALLENGE = 1023;
|
||||
REPLAY_LIST = 1100;
|
||||
REPLAY_DOWNLOAD = 1101;
|
||||
REPLAY_MODIFY_MATCH = 1102;
|
||||
|
|
@ -160,3 +163,30 @@ message Command_AccountPassword {
|
|||
optional string old_password = 1;
|
||||
optional string new_password = 2;
|
||||
}
|
||||
|
||||
message Command_ForgotPasswordRequest {
|
||||
extend SessionCommand {
|
||||
optional Command_ForgotPasswordRequest ext = 1021;
|
||||
}
|
||||
required string user_name = 1;
|
||||
optional string clientid = 2;
|
||||
}
|
||||
|
||||
message Command_ForgotPasswordReset {
|
||||
extend SessionCommand {
|
||||
optional Command_ForgotPasswordReset ext = 1022;
|
||||
}
|
||||
required string user_name = 1;
|
||||
optional string clientid = 2;
|
||||
optional string token = 3;
|
||||
optional string new_password = 4;
|
||||
}
|
||||
|
||||
message Command_ForgotPasswordChallenge {
|
||||
extend SessionCommand {
|
||||
optional Command_ForgotPasswordChallenge ext = 1023;
|
||||
}
|
||||
required string user_name = 1;
|
||||
optional string clientid = 2;
|
||||
optional string email = 3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public:
|
|||
virtual ServerInfo_User getUserData(const QString &name, bool withId = false) = 0;
|
||||
virtual void storeGameInformation(const QString & /* roomName */, const QStringList & /* roomGameTypes */, const ServerInfo_Game & /* gameInfo */, const QSet<QString> & /* allPlayersEver */, const QSet<QString> & /* allSpectatorsEver */, const QList<GameReplay *> & /* replayList */) { }
|
||||
virtual DeckList *getDeckFromDatabase(int /* deckId */, int /* userId */) { return 0; }
|
||||
|
||||
virtual bool removeForgotPassword(const QString & /* user */) { return false; }
|
||||
virtual qint64 startSession(const QString & /* userName */, const QString & /* address */, const QString & /* clientId */, const QString & /* connectionType */) { return 0; }
|
||||
virtual bool usernameIsValid(const QString & /*userName */, QString & /* error */) { return true; };
|
||||
public slots:
|
||||
|
|
@ -46,7 +46,7 @@ public:
|
|||
virtual void logMessage(const int /* senderId */, const QString & /* senderName */, const QString & /* senderIp */, const QString & /* logMessage */, LogMessage_TargetType /* targetType */, const int /* targetId */, const QString & /* targetName */) { };
|
||||
bool checkUserIsBanned(Server_ProtocolHandler *session, QString &banReason, int &banSecondsRemaining);
|
||||
virtual int checkNumberOfUserAccounts(const QString & /* email */) { return 0; };
|
||||
virtual bool changeUserPassword(const QString & /* user */, const QString & /* oldPassword */, const QString & /* newPassword */) { return true; };
|
||||
virtual bool changeUserPassword(const QString & /* user */, const QString & /* oldPassword */, const QString & /* newPassword */, const bool & /* force */) { return false; };
|
||||
virtual QChar getGenderChar(ServerInfo_User_Gender const & /* gender */) { return QChar('u'); };
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -507,7 +507,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdLogin(const Command_Login &cmd
|
|||
}
|
||||
|
||||
joinPersistentGames(rc);
|
||||
|
||||
databaseInterface->removeForgotPassword(userName);
|
||||
rc.setResponseExtension(re);
|
||||
return Response::RespOk;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue