on xenial help sign in
* Add --lightdm= argument to ./run.sh that lets developers choose which lightdm backend to use

* Stop letting a user that is immediately denied via PAM into the shell by fixing some assumptions that a user which was not prompted was successfully authenticated. This is not a common situation, you'd have to manually change your PAM config. * Fix a small console warning Approved by: Michał Sawicz

commit0573806714e970d5cf635088f781aa12093d8ad8 authorMichael Terry <michael.terry@canonical.com> dateThu 14 Aug 2014, 01:28 (12 years ago) parentd68b222187e7e5
4 files changed+39−23
qml/Components/Lockscreen.qml+3−1 qml/Shell.qml+4−4 run.sh+19−18 tests/mocks/LightDM/demo/CMakeLists.txt+13
qml/Components/Lockscreen.qml+3−1
@@ -68,7 +68,9 @@ Showable {
6868 }
6969
7070 function clear(showAnimation) {
71− pinPadLoader.item.clear(showAnimation);
71+ if (pinPadLoader.item) {
72+ pinPadLoader.item.clear(showAnimation);
73+ }
7274 }
7375
7476 function showInfoPopup(title, text) {
qml/Shell.qml+4−4
@@ -261,7 +261,7 @@ Item {
261261 }
262262
263263 onPromptlessChanged: {
264− if (LightDM.Greeter.promptless) {
264+ if (LightDM.Greeter.promptless && LightDM.Greeter.authenticated) {
265265 lockscreen.hide()
266266 } else {
267267 lockscreen.reset();
@@ -312,7 +312,7 @@ Item {
312312
313313 property bool fullyShown: showProgress === 1.0
314314 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
315− onShowProgressChanged: if (LightDM.Greeter.promptless && showProgress === 0) greeter.login()
315+ onShowProgressChanged: if (LightDM.Greeter.authenticated && showProgress === 0) greeter.login()
316316
317317 Greeter {
318318 id: greeter
@@ -350,7 +350,7 @@ Item {
350350 if (greeter.narrowMode) {
351351 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
352352 }
353− if (!LightDM.Greeter.promptless) {
353+ if (!LightDM.Greeter.authenticated) {
354354 lockscreen.reset();
355355 lockscreen.show();
356356 }
@@ -403,7 +403,7 @@ Item {
403403 }
404404
405405 if (LightDM.Greeter.active) {
406− if (!LightDM.Greeter.promptless) {
406+ if (!LightDM.Greeter.authenticated) {
407407 lockscreen.show()
408408 }
409409 greeter.hide()
run.sh+19−18
@@ -18,6 +18,7 @@ usage() {
1818 echo " -f, --fake Force use of fake Qml modules." >&2
1919 echo " -p, --pinlock Use a pin protected user." >&2
2020 echo " -k, --keylock Use a passphrase protected user." >&2
21+ echo " -l, --lightdm Use the specified lightdm mock." >&2
2122 echo " -g, --gdb Run through gdb." >&2
2223 echo " -h, --help Show this help." >&2
2324 echo " -m, --nomousetouch Run without -mousetouch argument." >&2
@@ -25,16 +26,20 @@ usage() {
2526 exit 1
2627}
2728
28−ARGS=`getopt -n$0 -u -a --longoptions="fake,pinlock,keylock,gdb,help,nomousetouch" -o "fpkghm" -- "$@"`
29+ARGS=`getopt -n$0 -u -a --longoptions="fake,pinlock,keylock,gdb,help,lightdm:,nomousetouch" -o "fpkl:ghm" -- "$@"`
2930[ $? -ne 0 ] && usage
3031eval set -- "$ARGS"
3132
3233while [ $# -gt 0 ]
3334do
3435 case "$1" in
35− -f|--fake) FAKE=true; USE_MOCKS=true;;
36− -p|--pinlock) PINLOCK=true; USE_MOCKS=true;;
37− -k|--keylock) KEYLOCK=true; USE_MOCKS=true;;
36+ -f|--fake) USE_MOCKS=true;;
37+ -p|--pinlock) USE_MOCKS=true; LIGHTDM_MOCK=single-pin;;
38+ -k|--keylock) USE_MOCKS=true; LIGHTDM_MOCK=single-passphrase;;
39+ -l|--lightdm) LIGHTDM_MOCK=$2; shift;
40+ if [ -z "$LIGHTDM_MOCK" ]; then
41+ echo "Please specify an argument to --lightdm"
42+ fi;;
3843 -g|--gdb) GDB=true;;
3944 -h|--help) usage;;
4045 -m|--nomousetouch) MOUSE_TOUCH=false;;
@@ -43,27 +48,23 @@ do
4348 shift
4449done
4550
46−if $FAKE; then
47− export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single
51+if [ -z "$LIGHTDM_MOCK" ]; then
52+ LIGHTDM_MOCK=single
4853fi
4954
50−if $PINLOCK; then
51− export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single-pin
52−fi
53−
54−if $KEYLOCK; then
55− export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics:$PWD/builddir/tests/mocks/LightDM/single-passphrase
56−fi
55+# Even without USE_MOCKS set, we want to fake our lightdm backend, because it's
56+# annoying to be prompted for your password when testing. To get the same
57+# backend used in production, pass '--lightdm=demo'.
58+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/LightDM/$LIGHTDM_MOCK
5759
5860if $USE_MOCKS; then
5961 rm -f $PWD/builddir/nonmirplugins/LightDM # undo symlink (from below) for cleanliness
6062 export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$PWD/builddir/tests/mocks:$PWD/builddir/plugins:$PWD/builddir/modules
63+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/libusermetrics
6164else
62− # Still fake no-login user for convenience (it's annoying to be prompted for your password when testing)
63− # And in particular, just link our LightDM mock into the nonmirplugins folder. We don't want the rest of
64− # our plugins to be used.
65− ln -s $PWD/builddir/tests/mocks/LightDM $PWD/builddir/nonmirplugins/
66− export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/builddir/tests/mocks/LightDM/single
65+ # Just link our LightDM mock into the nonmirplugins folder. We don't want
66+ # the rest of our plugins to be used.
67+ ln -sf $PWD/builddir/tests/mocks/LightDM $PWD/builddir/nonmirplugins/
6768fi
6869
6970QML_PHONE_SHELL_ARGS=""
tests/mocks/LightDM/demo/CMakeLists.txt+13
@@ -9,6 +9,7 @@ set(LibLightDM_SOURCES
99 )
1010
1111add_library(MockLightDM-demo STATIC ${LibLightDM_SOURCES})
12+add_library(MockLightDM-demo-shared SHARED ${LibLightDM_SOURCES})
1213
1314include_directories(
1415 ${CMAKE_CURRENT_BINARY_DIR}
@@ -19,5 +20,17 @@ target_link_libraries(MockLightDM-demo
1920 ${LIBUSERMETRICSOUTPUT_LDFLAGS}
2021 -lpam
2122)
23+target_link_libraries(MockLightDM-demo-shared
24+ ${LIBUSERMETRICSOUTPUT_LDFLAGS}
25+ -lpam
26+)
2227
2328qt5_use_modules(MockLightDM-demo Concurrent Gui)
29+qt5_use_modules(MockLightDM-demo-shared Concurrent Gui)
30+
31+set_target_properties(MockLightDM-demo-shared PROPERTIES
32+ OUTPUT_NAME lightdm-qt5-2)
33+
34+install(TARGETS MockLightDM-demo-shared
35+ DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/demo
36+ )