wip-account-creation #4

Merged
lash merged 143 commits from wip-account-creation into master 2024-08-30 14:37:58 +02:00
Showing only changes of commit 9cc75185b3 - Show all commits

View File

@ -14,6 +14,7 @@ import (
"git.defalsify.org/vise.git/cache" "git.defalsify.org/vise.git/cache"
"git.defalsify.org/vise.git/engine" "git.defalsify.org/vise.git/engine"
"git.defalsify.org/vise.git/lang"
"git.defalsify.org/vise.git/persist" "git.defalsify.org/vise.git/persist"
"git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/resource"
"git.defalsify.org/vise.git/state" "git.defalsify.org/vise.git/state"
@ -76,6 +77,16 @@ type fsData struct {
st *state.State st *state.State
} }
func codeFromCtx(ctx context.Context) string {
var code string
engine.Logg.DebugCtxf(ctx, "in msg", "ctx", ctx, "val", code)
if ctx.Value("Language") != nil {
lang := ctx.Value("Language").(lang.Language)
code = lang.Code
}
return code
}
func (fsd *fsData) SetLanguageSelected(ctx context.Context, sym string, input []byte) (resource.Result, error) { func (fsd *fsData) SetLanguageSelected(ctx context.Context, sym string, input []byte) (resource.Result, error) {
inputStr := string(input) inputStr := string(input)
res := resource.Result{} res := resource.Result{}
@ -269,8 +280,12 @@ func checkAccountStatus(trackingId string) (string, error) {
} }
func (fsd *fsData) quit(ctx context.Context, sym string, input []byte) (resource.Result, error) { func (fsd *fsData) quit(ctx context.Context, sym string, input []byte) (resource.Result, error) {
res := resource.Result{ res := resource.Result{}
Content: "Your account is being created", switch codeFromCtx(ctx) {
case "swa":
res.Content = "Asante kwa kutumia huduma ya Sarafu. Kwaheri!"
default:
res.Content = "Thank you for using Sarafu. Goodbye!"
} }
res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED) res.FlagReset = append(res.FlagReset, USERFLAG_ACCOUNT_UNLOCKED)
return res, nil return res, nil