77import com .gianlu .pyxreloaded .game .GameOptions ;
88import com .gianlu .pyxreloaded .server .Annotations ;
99import com .gianlu .pyxreloaded .server .Parameters ;
10+ import com .gianlu .pyxreloaded .singletons .Emails ;
1011import com .gianlu .pyxreloaded .singletons .LoadedCards ;
1112import com .gianlu .pyxreloaded .singletons .Preferences ;
1213import com .gianlu .pyxreloaded .singletons .SocialLogin ;
1819public class FirstLoadHandler extends BaseHandler {
1920 public static final String OP = Consts .Operation .FIRST_LOAD .toString ();
2021 private final LoadedCards loadedCards ;
22+ private final Emails emails ;
2123 private final SocialLogin socials ;
2224 private final Preferences preferences ;
2325
24- public FirstLoadHandler (@ Annotations .LoadedCards LoadedCards loadedCards , @ Annotations .SocialLogin SocialLogin socials , @ Annotations .Preferences Preferences preferences ) {
26+ public FirstLoadHandler (@ Annotations .LoadedCards LoadedCards loadedCards ,
27+ @ Annotations .Emails Emails emails ,
28+ @ Annotations .SocialLogin SocialLogin socials ,
29+ @ Annotations .Preferences Preferences preferences ) {
2530 this .loadedCards = loadedCards ;
31+ this .emails = emails ;
2632 this .socials = socials ;
2733 this .preferences = preferences ;
2834 }
@@ -48,14 +54,13 @@ public JsonWrapper handle(User user, Parameters params, HttpServerExchange excha
4854 }
4955 }
5056
51- // TODO: Is password login enabled?
52-
53- JsonWrapper socialsConfig = new JsonWrapper ();
54- if (socials .googleEnabled ()) socialsConfig .add (Consts .AuthType .GOOGLE , socials .googleAppId ());
55- if (socials .facebookEnabled ()) socialsConfig .add (Consts .AuthType .FACEBOOK , socials .facebookAppId ());
56- if (socials .githubEnabled ()) socialsConfig .add (Consts .AuthType .GITHUB , socials .githubAppId ());
57- if (socials .twitterEnabled ()) socialsConfig .add (Consts .AuthType .TWITTER , socials .twitterAppId ());
58- obj .add (Consts .GeneralKeys .AUTH_CONFIG , socialsConfig );
57+ JsonWrapper authConfig = new JsonWrapper ();
58+ if (emails .enabled ()) authConfig .add (Consts .AuthType .PASSWORD , emails .senderEmail ());
59+ if (socials .googleEnabled ()) authConfig .add (Consts .AuthType .GOOGLE , socials .googleAppId ());
60+ if (socials .facebookEnabled ()) authConfig .add (Consts .AuthType .FACEBOOK , socials .facebookAppId ());
61+ if (socials .githubEnabled ()) authConfig .add (Consts .AuthType .GITHUB , socials .githubAppId ());
62+ if (socials .twitterEnabled ()) authConfig .add (Consts .AuthType .TWITTER , socials .twitterAppId ());
63+ obj .add (Consts .GeneralKeys .AUTH_CONFIG , authConfig );
5964
6065 Set <PyxCardSet > cardSets = loadedCards .getLoadedSets ();
6166 JsonArray json = new JsonArray (cardSets .size ());
0 commit comments