@@ -54,14 +54,15 @@ type Auth struct {
5454	ActivateAccountURL         string 
5555	SatelliteName              string 
5656	service                    * console.Service 
57+ 	accountFreezeService       * console.AccountFreezeService 
5758	analytics                  * analytics.Service 
5859	mailService                * mailservice.Service 
5960	cookieAuth                 * consolewebauth.CookieAuth 
6061	partners                   * rewards.PartnersService 
6162}
6263
6364// NewAuth is a constructor for api auth controller. 
64- func  NewAuth (log  * zap.Logger , service  * console.Service , mailService  * mailservice.Service , cookieAuth  * consolewebauth.CookieAuth , partners  * rewards.PartnersService , analytics  * analytics.Service , satelliteName  string , externalAddress  string , letUsKnowURL  string , termsAndConditionsURL  string , contactInfoURL  string , generalRequestURL  string ) * Auth  {
65+ func  NewAuth (log  * zap.Logger , service  * console.Service , accountFreezeService   * console. AccountFreezeService ,  mailService  * mailservice.Service , cookieAuth  * consolewebauth.CookieAuth , partners  * rewards.PartnersService , analytics  * analytics.Service , satelliteName  string , externalAddress  string , letUsKnowURL  string , termsAndConditionsURL  string , contactInfoURL  string , generalRequestURL  string ) * Auth  {
6566	return  & Auth {
6667		log :                       log ,
6768		ExternalAddress :           externalAddress ,
@@ -74,6 +75,7 @@ func NewAuth(log *zap.Logger, service *console.Service, mailService *mailservice
7475		CancelPasswordRecoveryURL : externalAddress  +  "cancel-password-recovery/" ,
7576		ActivateAccountURL :        externalAddress  +  "activation/" ,
7677		service :                   service ,
78+ 		accountFreezeService :      accountFreezeService ,
7779		mailService :               mailService ,
7880		cookieAuth :                cookieAuth ,
7981		partners :                  partners ,
@@ -377,6 +379,38 @@ func loadSession(req *http.Request) string {
377379	return  sessionCookie .Value 
378380}
379381
382+ // IsAccountFrozen checks to see if an account is frozen. 
383+ func  (a  * Auth ) IsAccountFrozen (w  http.ResponseWriter , r  * http.Request ) {
384+ 	type  FrozenResult  struct  {
385+ 		Frozen  bool  `json:"frozen"` 
386+ 	}
387+ 
388+ 	ctx  :=  r .Context ()
389+ 	var  err  error 
390+ 	defer  mon .Task ()(& ctx )(& err )
391+ 
392+ 	userID , err  :=  a .service .GetUserID (ctx )
393+ 	if  err  !=  nil  {
394+ 		a .serveJSONError (w , err )
395+ 		return 
396+ 	}
397+ 
398+ 	frozenBool , err  :=  a .accountFreezeService .IsUserFrozen (ctx , userID )
399+ 	if  err  !=  nil  {
400+ 		a .serveJSONError (w , err )
401+ 		return 
402+ 	}
403+ 
404+ 	w .Header ().Set ("Content-Type" , "application/json" )
405+ 	err  =  json .NewEncoder (w ).Encode (FrozenResult {
406+ 		Frozen : frozenBool ,
407+ 	})
408+ 	if  err  !=  nil  {
409+ 		a .log .Error ("could not encode account status" , zap .Error (ErrAuthAPI .Wrap (err )))
410+ 		return 
411+ 	}
412+ }
413+ 
380414// UpdateAccount updates user's full name and short name. 
381415func  (a  * Auth ) UpdateAccount (w  http.ResponseWriter , r  * http.Request ) {
382416	ctx  :=  r .Context ()
0 commit comments