they're a little different .
1.When you leave, don't forget to lock the door.你走的时候不要忘记锁门。(it's not a need to use "当" here。)
2.When you left, you forgot to lock the door!. 。你走的时候忘了锁门.(it's not a need to use "当" here too,and people know its tense by language environment. and there's a sign of it, is "忘了”,this part showed you it's past tense, and other parts of this sentence couldn't be such signs.)
and,as you asked,i'll give some examples.at first,the two sentences you've given above are not accord with "当~~时/时候".
i think you should makeout the two forms by understand one word---当时。do you know this word?
当时 means "at the time"/"at that moment",so it's easy to know that "当时” is a word wich accord with past continuous tense.
then ""当~~时/时候" are derivational forms from it (当时)。they are apply to past continuous tense or past tense with a language environment of past continuous tense.. just the "~~" (between "当" and "时/时候" ) is a specific to the moment.(there's only one exception is "当~~时候” is also suitable for future tense<or language environment future tense>
examples:
1.当时。
------what were you doing at 21:00 yesterday evening?(昨天晚上九点的时候你在干什么?)
------i was reading a newspaper.(当时我在看报纸)
(i didn't use "当时”<at that moment> here in english ,it doesn't means it's not a need in chinese. actually it's language environment, and i showed you tenses in English). such a conversation translate into chinese ,better with "当时" though there's no "at that moment" in english,"