Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions base-component/webroot/screen/webroot/Login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,11 @@ along with this software (see the LICENSE.md file). If not, see
-->

<transition name="login" require-session-token="false">
<parameter name="username" />
<parameter name="password" />
<parameter name="code"/>
<actions>
<if condition="ec.web?.sessionAttributes?.moquiPreAuthcUsername"><then>
<!-- already pre-auth'ed, verify code below -->
<set field="username" from="ec.web?.sessionAttributes?.moquiPreAuthcUsername"/>
</then><else>
<!-- no pre-auth, try logging in (pre-auth if 2nd factor required) -->
<set field="loggedIn" from="ec.user.loginUser(username, password)"/>
</else></if>

<if condition="ec.web.sessionAttributes.moquiAuthcFactorRequired">
<if condition="code"><then>
<service-call name="org.moqui.impl.UserServices.validate#ExternalUserAuthcCode"
in-map="[code:code]" out-map="validateOut"/>
<if condition="validateOut.verified"><then>
<script>ec.user.internalLoginUser(validateOut.username)</script>
<return/>
</then><else>
<message error="true" public="true">Authentication code is not valid</message>
</else></if>
</then><else>
<message error="true" public="true">Authentication code required for user ${username}</message>
</else></if>
</if>
<service-call name="org.moqui.impl.UserServices.login#UserAccount" in-map="true" />
</actions>
<!-- no longer using SecondFactor screen, now built into Login screen to better support more scenarios:
<conditional-response url="../SecondFactor"><condition>
Expand Down
26 changes: 5 additions & 21 deletions base-component/webroot/screen/webroot/rest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,11 @@ along with this software (see the LICENSE.md file). If not, see
<parameter name="password" required="true"/>
<parameter name="code"/>
<actions>
<set field="loggedIn" from="ec.user.loginUser(username, password)"/>
<if condition="ec.message.hasError()"><script>ec.web.sendJsonResponse([loggedIn:false])</script></if>

<if condition="ec.web.sessionAttributes.moquiAuthcFactorRequired"><then>
<if condition="code"><then>
<service-call name="org.moqui.impl.UserServices.validate#ExternalUserAuthcCode"
in-map="[code:code]" out-map="validateOut"/>
<if condition="validateOut.verified"><then>
<script>ec.user.internalLoginUser(validateOut.username)</script>
<return/>
</then><else>
<message type="danger" public="true">Authentication code is not valid</message>
</else></if>
</then></if>

<!-- if we didn't return above send back info about user's authc factors -->
<service-call name="org.moqui.impl.UserServices.get#ExternalUserAuthcFactorInfo" out-map="factorInfoOut"/>
<script>ec.web.sendJsonResponse(factorInfoOut)</script>
</then><else>
<script>ec.web.sendJsonResponse([loggedIn:loggedIn])</script>
</else></if>
<service-call name="org.moqui.impl.UserServices.login#UserAccount"
in-map="true" out-map="loginOut" ignore-error="true" />
<script><![CDATA[
ec.web.sendJsonResponse(loginOut)
]]></script>
</actions>
<default-response type="none"/>
</transition>
Expand Down